from flask_classy import FlaskView, route

from ..models.fund_channel import FundChannel
from ..schema.resp import fund_channel_list as list_schema, query_resp
from ..services.fund_channel import FundChannelService


class FundChannelView(FlaskView):
    @route('/available')
    def get_available_list(self):
        fund_channel_list = FundChannelService.get_list(status=FundChannel.STATUS_ENABLED)
        data = list_schema.dump(fund_channel_list).data
        return query_resp.jsonify_with(items=data)
